﻿using System.ComponentModel;

namespace TK.TSocket
{
    /// <summary>
    /// 数据适配器配置
    /// </summary>
    public class TcpAdapterConfig
    {
        /// <summary>
        /// 服务端IP
        /// </summary>
        public string ServerIp { get; set; }

        /// <summary>
        /// 服务端口
        /// </summary>
        public int ServerPort { get; set; }

        /// <summary>
        /// 客户端IP
        /// </summary>
        public string ClientIp { get; set; }

        /// <summary>
        /// 客户端端口
        /// </summary>
        public int ClientPort { get; set; }

        /// <summary>
        /// 客户端唯一码
        /// </summary>
        public string ClientId { get; set; }

        /// <summary>
        /// 数据,ActionType = AdapterActionType.Receive有值，可实现通过首包数据内容分别为不同连接执行不同数据适配器。
        /// </summary>
        public byte[] Data { get; set; }
    }

    /// <summary>
    /// 数据适配器执行方式
    /// </summary>
    public enum AdapterActionType
    {
        /// <summary>
        /// 初次连接时
        /// </summary>
        [Description("初次连接时")]
        Connect = 1,

        /// <summary>
        /// 首次接收数据时
        /// </summary>
        [Description("首次接收数据时")]
        Receive = 3
    }
}
